import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SensitiveVO, SensitiveForm, SensitiveQuery } from '@/api/aiqa/sensitive/types';

/**
 * 查询敏感词管理列表
 * @param query
 * @returns {*}
 */

export const listSensitive = (query?: SensitiveQuery): AxiosPromise<SensitiveVO[]> => {
  return request({
    url: '/aiqa/sensitive/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询敏感词管理详细
 * @param id
 */
export const getSensitive = (id: string | number): AxiosPromise<SensitiveVO> => {
  return request({
    url: '/aiqa/sensitive/' + id,
    method: 'get'
  });
};

/**
 * 新增敏感词管理
 * @param data
 */
export const addSensitive = (data: SensitiveForm) => {
  return request({
    url: '/aiqa/sensitive',
    method: 'post',
    data: data
  });
};

/**
 * 修改敏感词管理
 * @param data
 */
export const updateSensitive = (data: SensitiveForm) => {
  return request({
    url: '/aiqa/sensitive',
    method: 'put',
    data: data
  });
};

/**
 * 删除敏感词管理
 * @param id
 */
export const delSensitive = (id: string | number | Array<string | number>) => {
  return request({
    url: '/aiqa/sensitive/' + id,
    method: 'delete'
  });
};
